package org.example.hansp.genetic.custom_generic;

public class CustomInterfaceGeneric01 {
    public static void main(String[] args) {

    }
}
interface IUsb<T,R>{
    T f2();

    R f3(T t1,T t2,R r1,R r2);

    default T f1(T t){
        return t;
    }
}
//自定义泛型接口在其继承接口时指定具体类型
interface IUsb2<Double,String> extends IUsb<Double,String>{

}
class IUsb2Impl implements IUsb2<Double,String>{

    @Override
    public Double f2() {
        return 0.0;
    }

    @Override
    public String f3(Double t1, Double t2, String r1, String r2) {
        return "";
    }
}
//在其实现类时指定具体类型
class IUsb1Impl implements IUsb<Integer,String>{

    @Override
    public Integer f2() {
        return 0;
    }

    @Override
    public String f3(Integer t1, Integer t2, String r1, String r2) {
        return "";
    }
}
//若没有指定，默认为Object
//等价与class IUsb1Impl2 implements IUsb<Object,Object>
class IUsb1Impl2 implements IUsb{
    @Override
    public Object f2() {
        return null;
    }

    @Override
    public Object f3(Object t1, Object t2, Object r1, Object r2) {
        return null;
    }
}
